package org.example.day06;

import java.io.*;

public class TestFile {
    public static void main3(String[] args) throws IOException {
        String from = "D:/..";
        String toPath = "D:/..";
        FileReader fr = new FileReader(from);
        BufferedReader br = new BufferedReader(fr);
        String l = br.readLine();
        br.close();
        fr.close();
    }
    public static void main2(String[] args) {
        FileInputStream fis = null;
        FileOutputStream fos = null;

        String from = "D:/..";
        String toPath = "D:/..";
        //创建输入输出流文件
        try {
            fis = new FileInputStream(from);
            fos = new FileOutputStream(toPath);
            //输入流读入
            //available()获取输入流大小
            byte[] arr = new byte[fis.available()];
            fis.read(arr);
            fos.write(arr);
            fis.close();
            fos.close();
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }


    }
    public static void main1(String[] args) throws IOException {
        File path = new File("d:/test");
        if(!path.exists()){
            System.out.println("目录不存在,开始创建..");
            path.mkdirs();
        }
        String filename = "text01.txt";
        File f = new File(path,filename);
//        try {
//            boolean re = f.createNewFile();
//        }catch (IOException e){
//
//        }



    }

}
